﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Game.Handlers;
using System.Data.OleDb;


namespace Game
{
    public partial class LoadGame : Form
    {
        public LoadGame()
        {
            InitializeComponent();
        }

        private void LoadGame_Load(object sender, EventArgs e)
        {
            try
            {
                DBManager dbm = new DBManager();
                string DBQuery = "SELECT * FROM `Characters`";
                dbm.ORead(DBQuery);
                dbm.oconn.Close();
                OleDbDataAdapter oda = new OleDbDataAdapter(dbm.ocomm);
                DataSet ds = new DataSet();
                oda.Fill(ds);
                DataTable dt = ds.Tables[0];

                foreach (DataRow dr in dt.Rows)
                {
                    this.SaveList.Items.Add(dr[1].ToString());
                    this.bx_DateSaved.Text = dr[28].ToString();
                }
                dbm.oconn.Close();
            }
            catch (OleDbException oe)
            {
                MessageBox.Show("Error Loading Saves.   " + oe);  
            }
            
        }

        private void button1_Click(object sender, EventArgs e)
        {

        }
    }
}
